﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HanoiSimulator
{
    public partial class StepHelper : Form
    {
        List<string> TipList;
        int thisStep;


        public StepHelper(int FloorCount)
        {
            InitializeComponent();
            Hanoi hanoi = new Hanoi();
            hanoi.Solve(FloorCount);
            TipList = new List<string>();
            TipList.AddRange(hanoi.GetStepArray());
            thisStep = -1;
            NextStep();
            lblFloorCount.Text = "当前设定层数：";
            if (FloorCount < 10)
            {
                lblFloorCount.Text += " ";
            }
            lblFloorCount.Text += FloorCount.ToString();
        }

        internal void NextStep()
        {
            thisStep++;
            if (thisStep >= TipList.Count())
                return;
            txbActionBox.Text = TipList[thisStep];
        }

        private void txbActionBox_DoubleClick(object sender, EventArgs e)
        {
            
        }

        private void StepHelper_FormClosing(object sender, FormClosingEventArgs e)
        {
            Environment.Exit(0);
        }
    }
}
